<?php

namespace Home\Model;
use Think\Model;

class PersonServerModel extends Model
{
	/**
	 * 获取项目列表
	 */
	public function getPersonServerList()
	{
        // 坚决不能用select *,防止索引失效
        $field = 'name, server, font_url, back_url, account, password, db_name, code_path';
        $order = 'update_ts desc';
        $where = array(
            'del_flg' => 0
        );
		return $this->field($field)
                    ->cache(true)
                    ->where($where)
                    ->order($order)
                    ->select();
	}

    /**
     * 统计点击次数
     *
     * @param $id
     * @return mixed
     */
    public function countServer($id)
	{
		return $this->cache(true)->where(array('id' => $id))->setInc('click_times');
	}
}